package tw.com.softleader.movie.service.impl;

import java.util.List;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import tw.com.softleader.movie.dao.MovieDao;
import tw.com.softleader.movie.entity.Movie;
import tw.com.softleader.movie.service.MovieService;

@Service
public class MovieServiceImpl implements MovieService{

	private static final Logger log = LoggerFactory.getLogger(MovieServiceImpl.class);
	
	@PostConstruct
	public void init(){
		log.debug("MovieServiceImpl - init()");
	}
	
	/** 指定要Inject的對象 */
	@Autowired
	@Qualifier("movieDaoImpl")
	private MovieDao movieDao;

	@Autowired
	@Qualifier("movieDaoImplB")
	private MovieDao movieDaoB;
	
	@Override
	public List<Movie> getAll() {
		return movieDao.findAll();
	}

	@Override
	public Movie getOne(Long id) {
		return movieDao.findOne(id);
	}

	public void setMovieDao(MovieDao movieDao) {
		this.movieDao = movieDao;
	}

}
